package com.kugua.zfms.web.demo;

import com.kugua.zfms.mapper.base.LoginLogMapper;
import com.kugua.zfms.mapper.censor.CensorContentMapper;
import com.kugua.zfms.mq.RocketProviderClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.concurrent.TimeUnit;

/**
 * <p>TODO</p>
 * <p>
 * <PRE>
 * <BR>    修改记录
 * <BR>-----------------------------------------------
 * <BR>    修改日期         修改人          修改内容
 * </PRE>
 *
 * @author cuiyh9
 * @version 1.0
 * @Date Created in 2018年11月19日 18:16
 * @since 1.0
 */
@Controller
@RequestMapping("demo")
public class DemoController {

//    @Autowired
//    private LoginLogMapper loginLogMapper;
//
//    @Autowired
//    private CensorContentMapper censorContentMapper;

    @Autowired
    private RocketProviderClient rocketProviderClient;

    @RequestMapping("index")
    public String index() throws InterruptedException {
//        int count = loginLogMapper.selectCount();
//        System.out.println("loginLogMapper count:" +  count);
//        int censorCount = censorContentMapper.selectCount();
        int i = 0;
        int j = 10;
        while (i < 10) {
            TimeUnit.SECONDS.sleep(3);
            rocketProviderClient.sendMsgByTopic(RocketProviderClient.TOPIC_CENSOR_FEED, RocketProviderClient.TOPIC_CENSOR_FEED);
        }
//        System.out.println("censorContentMapper count:" +  censorCount);
        return "index/index.html";
    }

    @RequestMapping("list")
    public String listUser(Model model) {
        model.addAttribute("demo", "demo");

        return "/demo/list";
    }
}
